package imanager.showcases.agenda.client;

import com.googlecode.imanager.client.Application;
import com.googlecode.imanager.client.action.Action;
import com.googlecode.imanager.client.style.HorzAlignment;
import com.googlecode.imanager.client.style.VertAlignment;
import com.googlecode.imanager.client.util.Anchors;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class AgendaApplication extends Application {

    private static final long serialVersionUID = 1L;
    
    protected ListaComprasDocument listaComprasDocument;
    protected CadastroEntidadeDocument cadastroEntidadeDocument;
    
    protected Action exportarXlsAction;
    protected Action exportarPdfAction;
    
    public AgendaApplication() {
        createListaComprasDocument();
    }

    protected void createListaComprasDocument() {
        listaComprasDocument = new ListaComprasDocument();
        listaComprasDocument.setPosition(HorzAlignment.CENTER, VertAlignment.MIDDLE);
        listaComprasDocument.setAnchors(Anchors.MIDDLE);        
        this.add(listaComprasDocument);
    }

    protected void createCadastroEntidadeDocument() {
        cadastroEntidadeDocument = new CadastroEntidadeDocument();
        cadastroEntidadeDocument.setPosition(HorzAlignment.CENTER, VertAlignment.MIDDLE);
        cadastroEntidadeDocument.setAnchors(Anchors.MIDDLE);
        cadastroEntidadeDocument.setModal(true);
        this.add(cadastroEntidadeDocument);
    }

    public ListaComprasDocument getListaComprasDocument() {
        if (listaComprasDocument == null){
            createListaComprasDocument();
        }
        return listaComprasDocument;
    }

    public CadastroEntidadeDocument getCadastroEntidadeDocument() {
        if (cadastroEntidadeDocument == null){
            createCadastroEntidadeDocument();
        }
        return cadastroEntidadeDocument;
    }

    public void setExportarPdfAction(Action exportarPdfAction) {
        this.exportarPdfAction = exportarPdfAction;
    }

    public Action getExportarPdfAction() {
        return exportarPdfAction;
    }

    public Action getExportarXlsAction() {
        return exportarXlsAction;
    }

    public void setExportarXlsAction(Action exportarXlsAction) {
        this.exportarXlsAction = exportarXlsAction;
    }    
    
}
